import org.junit.Assert;
import org.junit.jupiter.api.Test;

import info.gridworld.actor.*;
import info.gridworld.grid.Location;
import java.awt.Color;

class JumperTest {
	public ActorWorld world = new ActorWorld();
	public Jumper jumper1 = new Jumper();
	public Jumper jumper2 = new Jumper(Color.BLUE);
	public Rock rock = new Rock();
	public Flower flower = new Flower();
	public Location loc1 = new Location(2, 2);
	public Location loc2 = new Location(2, 4);
	
	@Test
	void testJump() {
		world.add(new Location(4, 2), jumper1);
		jumper1.jump();
		Location loc3 = jumper1.getLocation();
		Assert.assertEquals(loc1, loc3);
	}
	
	@Test
	void testCanJump() {
		world.add(new Location(4, 2), jumper1);
		world.add(new Location(2, 2), rock);
		boolean b = jumper1.canJump();
		Assert.assertEquals(b, false);
	}
	
	@Test
	void testTurn() {
		world.add(new Location(4, 2), jumper1);
		jumper1.turn();
		int d = jumper1.getDirection();
		Assert.assertEquals(d, 45);
	}
	
	@Test
	void testAct() {
		world.add(new Location(4, 2), jumper1);
		world.add(new Location(3, 2), jumper2);
		jumper1.act();
		jumper1.act();
		Location loc3 = jumper1.getLocation();
		Assert.assertEquals(loc3, loc2);
	}
	
	@Test
	void testAct2() {
		world.add(new Location(4, 2), jumper1);
		world.add(new Location(3, 2), rock);
		jumper1.act();
		Location loc3 = jumper1.getLocation();
		Assert.assertEquals(loc3, loc1);
	}
}
